package com.bdqn.ch08.service.impl;

import com.bdqn.ch08.mapper.SysUserMapper;
import com.bdqn.ch08.pojo.SysUser;
import com.bdqn.ch08.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * SysUserServiceImpl
 *
 * @aurhor Administrator  whs
 * @since 2024/7/19
 */
@Scope("prototype")
//@Transactional // 为该类的所有业务方法统一添加事务处理
@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService {

    @Autowired  //@ Resource
    private SysUserMapper sysUserMapper;

    @Transactional(propagation = Propagation.SUPPORTS)




    public SysUserMapper getSysUserMapper() {
        return sysUserMapper;
    }

    public void setSysUserMapper(SysUserMapper sysUserMapper) {
        this.sysUserMapper = sysUserMapper;
    }

    /**
     * 添加用户信息
     *
     * @param sysUser
     * @return
     */
    @Override
    public int addSysUser(SysUser sysUser) {
        return sysUserMapper.addSysUser(sysUser);
    }

    /**
     * 修改用户信息
     *
     * @param sysUser
     * @return
     */
    @Override
    public int updateSysUser(SysUser sysUser) {
        return sysUserMapper.updateSysUser(sysUser);
    }

    /**
     * 删除用户信息
     *
     * @param id
     * @return
     */
    @Override
    public int deleteSysUser(int id) {
        return sysUserMapper.deleteSysUser(id);
    }
}
